package com.choosefine.it.team.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.choosefine.it.base.BaseController;
import com.choosefine.it.common.def.ResultCode;
import com.choosefine.it.project.service.ProjectManageService;
import com.choosefine.it.team.model.TeamProjectManageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * 班组—项目管理
 * 
 * @author Administrator
 * 
 */
@RestController
@RequestMapping("/teamProjectManage")
@Api(value = "班组—项目管理", description = "廖仉根")
public class TeamProjectManageController extends BaseController {
	@Autowired
	ProjectManageService projectManageService;

	@ApiOperation(value = "班组—项目管理-根据班组usercode查看项目", notes = "", response = TeamProjectManageInfo.class)
	@ApiImplicitParam(name = "userCode", value = "班组usercode", required = true, dataType = "String", paramType = "path")
	@RequestMapping(value = "/getListByTeamUsercode/{userCode}", method = RequestMethod.GET)
	public String getListByConstructUsercode(@PathVariable String userCode) {
		String result = null;
		if (!StringUtils.isEmpty(userCode)) {
			List<TeamProjectManageInfo> list = projectManageService.getListByTeamUsercode(userCode);
			result = responseArraySuccess(list, ResultCode.SUCCESS,	ResultCode.MSG_SUCCESS);
		} else {
			result = responseFail(ResultCode.FAILED, ResultCode.MSG_PARAMS_NULL);
		}
		return result;
	}
}
